﻿// JavaScript Document
var boxnum=1;

function $(objname) { return document.getElementById(objname); }
function settab(input) {
    boxnum = input;
    if (input == 3) {
        // $('b1').className = 'sc'; $('b2').className = 'hc';
        $("submit_google").value = "Google搜索";
        $("frmbaidu").className = 'hc';
        $('divTime').className = 'hc';
        $('divTransfer').className = 'hc';
        $("frmgoogle").className = 'sc';
       
    }
//    else {
//        $('b1').className = 'hc'; $('b2').className = 'sc';
    //    }
    else if(input == 1) {
            $("frmbaidu").className = 'hc';
            $('divTime').className = 'sc';
            $('divTransfer').className = 'hc';
            $("frmgoogle").className = 'hc';
         $("submit_btn2").value = "时刻表查询";
         $("tfrom").focus();
    }
    else if (input == 2) {
        
            $("frmbaidu").className = 'hc';
            $('divTime').className = 'hc';
            $('divTransfer').className = 'sc';
            $("frmgoogle").className = 'hc';
          $("submit_btn2").value = "搜索转让火车票";
          $("from").focus();
       // if ($('stationname').value == "" || $('stationname').value == "请输入列车车次") $('stationname').value = "请输入列车站点名称";
    }
    else if (input == 4) {
            //if ($('stationname').value == "" || $('stationname').value == "请输入列车车次") $('stationname').value = "请输入列车站点名称";

        $("submit_baidu").value = "百度一下";
        $("frmbaidu").className = 'sc';
        $('divTime').className = 'hc';
        $('divTransfer').className = 'hc';
        $("frmgoogle").className = 'hc';
        $("kw2").focus();
    }
    for (i = 1; i < 5; i++) {
        if (i == input) {
         $('Radio' + i).checked = true;
         $('tab' + i).className = "selected"; }
        else { $('tab' + i).className = ""; }
    }
    setCookies("default_tab",input);

}
function initTab() {

    if (getCookie("default_tab") != null) {
        settab(getCookie("default_tab"));
    }
}


function setlistshow(input) {
    switch (input) {
        case 1: $('list_div1').className = "sc dplist"; break;
        case 2: $('list_div1').className = "sc dplist dplist2"; break;
        case 3: $('list_div1').className = "sc dplist dplist3"; break;

    }

}


function setFouce(num) {
    if (num == 1) {
        document.getElementById("cha_1").className = "chaxun";
        document.getElementById("sea_1").style.display = "block";
        document.getElementById("sea_2").style.display = "none";
        document.getElementById("cha_2").className = "";
        document.getElementById("sea_3").style.display = "none";
        document.getElementById("cha_3").className = "";
    }
    else if (num == 2) {
        document.getElementById("cha_2").className = "chaxun";
        document.getElementById("cha_1").className = "";
        document.getElementById("sea_2").style.display = "block";
        document.getElementById("sea_1").style.display = "none";
        document.getElementById("sea_3").style.display = "none";
        document.getElementById("cha_3").className = "";
    }
    else {
        document.getElementById("cha_3").className = "chaxun";
        document.getElementById("sea_3").style.display = "block";
        document.getElementById("sea_2").style.display = "none";
        document.getElementById("cha_2").className = "";
        document.getElementById("sea_1").style.display = "none";
        document.getElementById("cha_1").className = "";
    }
}
function navigate(key) {
    var keyword = $(key).value;
   
    if (keyword == "") {
        alert("请输入完整的数据，再搜索");
        return false;
    }
    return true;

}

function vsearch() {

    if (boxnum == 1) {
        var cc1 = document.getElementById("tfrom");
        var cc2 = document.getElementById("tto");
        if (cc1.value == "" || cc2.value == "") {
            alert("请输入出发地和目的地!~");
            return false;
        }
    }
    else if (boxnum == 2) {
        var c1 = document.getElementById("from");
        var c2 = document.getElementById("to");
        if (c1.value == "" || c2.value == "") {
            alert("请输入出发地和目的地!~");
            return false;
        }
    }
    return true;
}

function setCookies(name,value) {

   var Days = 1000; //此 cookie 将被保存 30 天
   var exp   = new Date();     //new Date("December 31, 9998");
   exp.setTime(exp.getTime() + Days*24*60*60*1000);
   document.cookie = name + "=" + escape(value) + ";expire*=" + exp.toGMTString();
}
function getCookie(name)  
 {  
     var arr,reg=new RegExp("(^|)"+name+"=([^;]*)(;|$)");  
     if(arr=document.cookie.match(reg))
	return unescape(arr[2]);  
     else
	return null;  
 }  
function baidusearch(num) {
	word = document.getElementById("kw"+num).value;
    type = document.getElementById("type"+num).value;
    //window.open("http://www.easydp.net/?kw=" + word + "&se=baidu&type="+type);
    window.open("http://localhost/easydp/Views/Search.htm?kw=" + word + "&se=baidu&type=" + type);
}
function googlesearch(num) {
	word = document.getElementById("kw"+num).value;
	type = document.getElementById("type"+num).value;
	window.open("http://localhost/easydp/Views/Search.htm?kw=" + word + "&se=google&type=" + type);
}

function Menu(index) {
    var num = $("conBox").getElementsByTagName("div");
    for (var i = 1; i <= num.length; i++) {
        if ($("con" + i) && $("m" + i)) {
            $("con" + i).style.display = "none";
            $("m" + i).className = "";
        }
    }
    if ($("con" + index) && $("m" + index)) {
        if (index == 2 && $("ifrm" + index)) {
            $("ifrm2").src = 'http://finance.sina.com.cn/promotion/20081119/001.shtml';
        }
        if (index == 3 && $("ifrm" + index)) {
            $("ifrm3").src = '/city/province_index.html';
        }
        if (index == 4 && $("ifrm" + index)) {

            $("ifrm4").src = 'visited.html';
        }
        if (index == 5 && $("ifrm" + index)) {
            $("ifrm5").src = 'getMyBookMark.php';
        }
        $("con" + index).style.display = "block";
        $("m" + index).className = "at";
    }
}
//window.onload = function() { init(); }
var j
function init() {
    var getSo = $('search').getElementsByTagName('div');
    j = getSo.length;
    var links = $('tab').getElementsByTagName('b');
    for (var i = 0; i < j; i++) {
        getSo[i].id = 'cont_tab' + i;
        getSo[i].setAttribute("id", 'cont_tab' + i);
        links[i].setAttribute("id", 'tab' + i);
        links[i].onclick = function() { displayTab(this) }
        var getForm = getSo[i].getElementsByTagName('form');
        getForm[0]['kw'].onchange = function() { changeKw(this) }
    }

}
function displayTab(this_tab) {
    for (var i = 0; i < j; i++) {
        $('cont_tab' + i).style.display = "none";
        $('tab' + i).className = '';
    }
    $('cont_' + this_tab.id).style.display = "block";
    $(this_tab.id).className = 'bStyle';
}
function changeKw(thisKw) {
    for (var i = 0; i < j; i++) {
        getForm = $('cont_tab' + i).getElementsByTagName('form');
        if (getForm[0]['kw'].id != thisKw.id)
            getForm[0]['kw'].value = thisKw.value;
    }
}
function setDisplay(i, d) {
    $(i).style.display = d ? "block" : "none";
}

function googleHint(key) {
    if ($('gsuggest')) $('gsuggest').parentNode.removeChild($('gsuggest'));
    var sg = document.body.appendChild(document.createElement('script'));
    sg.language = 'javascript';
    sg.id = 'gsuggest';
    sg.charset = 'utf-8';
    sg.src = 'http://www.google.cn/complete/search?hl=zh-CN&client=suggest&js=true&q=' + encodeURIComponent(key);
}

function myhint(event) {
    var keyword = $('kw1');
    var h = $('suggests');
    if (!keyword.value || !keyword.value.length || event.keyCode == 27 || event.keyCode == 13) {
        h.style.display = 'none';
        return;
    }
    if (event.keyCode == 38 || event.keyCode == 40) {
        if (h.style.display == 'none') return;
        if (event.keyCode == 38) {
            if (h._i == -1) h._i = h.firstChild.rows.length - 1;
            else {
                h._i--;
            }
        } else {
            h._i++;
        }
        for (var i = 0; i < h.firstChild.rows.length; i++) h.firstChild.rows[i].style.background = "#FFF";
        if (h._i >= 0 && h._i < h.firstChild.rows.length) with (h.firstChild.rows[h._i]) {
            style.background = "#E6E6E6";
            keyword.value = cells[0].innerText;
        } else {
            keyword.value = h._kw;
            h._i = -1;
        }
    } else {
        h._i = -1;
        h._kw = keyword.value;
        googleHint(keyword.value);
        var pos = getPosition(keyword);
        with (h.style) {
            // left = pos.x;
           
            //top = pos.y + keyword.offsetHeight;
            left = calculateOffsetLeft(keyword) + "px";
            top = keyword.offsetHeight + 4 + "px";
            
            width = keyword.offsetWidth - 2;
        }
    }
}

function getPosition(ele) {
    var overflown = [];
    var el = ele, left = 0, top = 2;
    do {
        left += el.offsetLeft || 0;
        top += el.offsetTop || 0;
        el = el.offsetParent;
    } while (el);
    return { 'x': left-300, 'y': top-140 };
}
// Called as:
// calculateOffsetLeft(this._inputBox)
function calculateOffsetLeft(r) {
    return getOffsetToWindow(r, "offsetLeft");
}

// Called as:
// calculateOffsetTop(this._inputBox)
function calculateOffsetTop(r) {
    return getOffsetToWindow(r, "offsetTop");
}
function getOffsetToWindow(r, attr) {
    var kb = 0;
    alert(r);
    while (r) {
        
        kb += r[attr];
        r = r.offsetParent;
    }
    return kb;
}

window.google = {};
window.google.ac = {};

window.google.ac.Suggest_apply = function(a, b, c, d) {
    if (!c || c.length < 3) return;
    if (b != $('kw1').value) return;
    var ihtml = '';
    for (var j = 1; j < c.length; j += 2) {
        ihtml += '<tr style="cursor:hand" onmousedown="javascript:searchSubmit(this)" onmouseover="javascript:this.style.background=\'#E6E6E6\';$(\'kw1\').value=\'' + c[j] + '\';" onmouseout="javascript:this.style.background=\'#FFF\';"><td style="color:#000;font-size:12px;" align="left">' + c[j] + '</td><td style="color:#090" align="right" style="font-size:11.5px;">约' + c[j + 1] + '</td></tr>';
    }
    $('suggests').innerHTML = '<table width="100%" border="0" cellpadding="0" cellspacing="0">' + ihtml + '</table>';
    setDisplay('suggests', 1);
};

function searchSubmit(index) {
    formInfo = index.parentNode.parentNode.parentNode.parentNode;
    if (formInfo.tagName == "FORM") {
        formInfo.submit();
    }
}
(function() {
    var x = "appendChild", y = "length", A = "split", E = "value", Aa = "focus"; window.hao360cn = {}; window.hao360cn.check = checkMail;
    function w(a, b) { return a.value = b }
    function ja(a, b) { return a.name = b }
    function checkMail(a) {
        if (a.MailBox.options.selectedIndex == 0) { alert("\u63d0\u793a\uff1a\u8bf7\u6b63\u786e\u9009\u62e9\u4f60\u4f7f\u7528\u7684\u90ae\u7bb1"); return false; } if (a.Username[E] == "" || a.Username[E] == "\u8bf7\u5728\u6b64\u8f93\u5165\u60a8\u7684\u7528\u6237\u540d") { alert("\u63d0\u793a\uff1a\u90ae\u7bb1\u7528\u6237\u540d\u5fc5\u987b\u586b\u5199\uff01"); a.Username[Aa](); return false; } if (a.Password[E] == "" || a.Password[E][y] < 3) { alert("\u63d0\u793a\uff1a\u90ae\u7bb1\u5bc6\u7801\u5fc5\u987b\u586b\u5199\u5b8c\u6574\uff01"); a.Password[Aa](); return false; } var b = [];
        b["36000"] = new Array("https://passport.baidu.com/?login", "username", "password");
        b["36001"] = new Array("http://reg.163.com/in.jsp?url=http://fm163.163.com/coremail/fcg/ntesdoor2?language=0&style=1", "username", "password");
        b["36002"] = new Array("http://vip.163.com/logon.m", "username", "password", "enterVip,true; style,");
        b["36003"] = new Array("http://reg.163.com/logins.jsp", "username", "password", "domain,126.com; url,http://entry.mail.126.com/cgi/ntesdoor?lightweight%3D1%26verifycookie%3D1%26language%3D0%26style%3D-1", "@126.com");
        b["36004"] = new Array("http://mail.sina.com.cn/cgi-bin/login.cgi", "u", "psw", "logintype,uid; product,mail");
        b["36005"] = new Array("http://vip.sina.com.cn/cgi-bin/login.cgi", "user", "pass");
        b["36006"] = new Array("http://passport.sohu.com/login.jsp", "loginid", "passwd", "fl,1; vr,1|1; appid,1000; ru,http://login.mail.sohu.com/servlet/LoginServlet; eru,http://login.mail.sohu.com/login.jsp; ct,1173080990; sg,5082635c77272088ae7241ccdf7cf062", "@sohu.com");
        b["36007"] = new Array("http://passport.sohu.com/login.jsp", "loginid", "passwd", "fl,1; vr,1|1; appid,1013; ru,http://vip.sohu.com/login/viplogin11.jsp; eru,; ct,1173857434; sg,885ebb7884194ee547f224fc8a6a5877", "@vip.sohu.com");
        b["36008"] = new Array("http://passport.21cn.com/maillogin.jsp", "LoginName", "passwd", "NeedMoreSecurity,on; NeedIpCheck,on");
        b["36009"] = new Array("http://g2wm.263.net/xmweb", "usr", "pass", "domain,263.net; func,login");
        b["36010"] = new Array("http://bjweb.163.net/cgi/163/login_pro.cgi", "user", "pass", "type,0; style,10");
        b["36011"] = new Array("http://mail.china.com/xmweb", "usr", "pass", "func,login");
        b["36012"] = new Array("http://reg.mail.188.com/servlet/coremail/login", "user", "pass", "domain,188.com; language,0; style,-1");
        b["36013"] = new Array("http://edit.bjs.yahoo.com/config/login", "login", "passwd", ".intl,cn; .done,http://mail.yahoo.com");
        b["36015"] = new Array("https://www.google.com/accounts/ServiceLoginAuth", "Email", "Passwd", "continue,http://mail.google.com/mail?zy=l; service,mail; hl,zh-CN");
        b["36016"] = new Array("http://passport.51.com/login.5p", "passport_51_user", "passport_51_password", "gourl,http://my.51.com/webim/index.php?refer=");
        b["36017"] = new Array("http://passport.sohu.com/login.jsp", "loginid", "passwd", "appid,1005; fl,1; vr,1|1; ru,http://profile.chinaren.com/urs/setcookie.jsp?burl=http://alumni.chinaren.com/; ct,1174378209; sg,84ff7b2e1d8f3dc46c6d17bb83fe72bd", "@chinaren.com");
        b["36018"] = new Array("http://login.xiaonei.com/Login.do", "email", "password");
        b["36019"] = new Array("http://www.hainei.com/account?a=login&h=aa71efbd", "email", "password");
        b["36020"] = new Array("http://www.kaixin001.com/login/login.php", "email", "password", "url, http://www.kaixin001.com/home/");
        b["36021"] = new Array("http://n20svrg3.139.com/default.aspx", "txtUserName", "txtPassword", "loginType,0");
        b["36022"] = new Array("https://reg.163.com/logins.jsp?type=1&product=mailyeah&url=http://entry.mail.yeah.net/cgi/ntesdoor?lightweight%3D1%26verifycookie%3D1%26style%3D-1", "username", "password", "", "@yeah.net");
        var c = a.MailBox[E], d = $("Username")[E]; if (b[c] != null) { var e = b[c]; a.action = e[0]; ja($("Username"), e[1]); ja($("Password"), e[2]); if (e[3] != null) { var g = e[3][A]("; "), h = 0; for (; h < g[y]; h++) { var f = g[h][A](","), i = document.createElement("INPUT"); i.type = "hidden"; ja(i, f[0]); w(i, f[1]); $("MailCheck")[x](i) } } if (e[4] != null) w($("Username"), d + e[4]) } else alert("\u8bf7\u9009\u62e9\u6b63\u786e\u7684\u90ae\u7bb1\uff01"); a.submit(); w($("Username"), d); w($("Password"), "")
    }
})();
var _s = window.hao360cn;